class TFCMFire extends TFProjectileFire;

var float LastFireTime, factor;

event ModeDoFire()
{
	if ( Level.TimeSeconds - LastFireTime > 0.4 )
		factor = 1;
	else
		factor = FMin(factor+0.55,6);

    ShakeOffsetMag = default.ShakeOffsetMag*factor;
    if(instigator.bIsCrouched) ShakeOffsetMag/=4;

	LastFireTime = Level.TimeSeconds;
	Super.ModeDoFire();
}

function InitEffects()
{
    Super.InitEffects();
    if ( FlashEmitter != None )
		Weapon.AttachToBone(FlashEmitter, 'tip');
}

function PlayFiring()
{
    local rotator rot;

    rot=instigator.Controller.rotation;

    rot.pitch+=(ShakeOffsetMag.z*frand()*15)-ShakeOffsetMag.z*3.5;
    rot.yaw+=(ShakeOffsetMag.y*frand()*15)-ShakeOffsetMag.y*7.5;

    rot.Pitch=fmin(rot.Pitch, 65530);

    instigator.Controller.setrotation(rot);

    super.PlayFiring();
}

defaultproperties
{
     ProjSpawnOffset=(X=24.000000,Y=8.000000,Z=-7.000000)
     FireAnimRate=1.750000
     FireSound=Sound'TFMedia.Commando.TFCMFire'
     FireForce="ShockRifleAltFire"
     FireRate=0.10000
     AmmoClass=Class'taskforces.TFCMAmmo'
     AmmoPerFire=1
     ShakeRotMag=(X=60.000000,Y=20.000000)
     ShakeRotRate=(X=1000.000000,Y=1000.000000)
     ShakeRotTime=2.000000
     ShakeOffsetMag=(X=-5.000000,Y=11.000000,Z=22.000000)
     ShakeOffsetRate=(X=-1500.000000)
     ShakeOffsetTime=1.250000
     ProjectileClass=Class'taskforces.TFCMProj'
     BotRefireRate=0.350000
     WarnTargetPct=0.100000
     FlashEmitterClass=Class'taskforces.TFCMMuz1st'
     Spread=2.000000
     SpreadStyle=SS_Random
}
